<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Title</title>
    <style>
        *{
            margin:0;
        }
        .box{
            border:5px solid #36D;
            width:500px;
            height:300px;
            /*溢出隐藏*/
            overflow: hidden;
            /*水平居中*/
            margin:0 auto;
        }
        .box ul{
            list-style:none;
            width:2000px;
            height:300px;
            padding-left:0;
            /*相对定位*/
            position: relative;
        }
        .box ul li{
            float:left;

        }
        .box ul li img{
            width: 500px;
            height: 300px;
        }
        button{
            width: 100px;
            height: 60px;
            display: block;
            margin:0 auto;
        }
    </style>

</head>
<body>
    <div class="box">
        <ul>
            <li><img src="images/1.png" alt=""></li>
            <li><img src="images/2.png" alt=""></li>
            <li><img src="images/3.png" alt=""></li>
            <li><img src="images/1.png" alt=""></li>
        </ul>
    </div>
    <button>下一张</button>
</body>
<script src="js/jquery.js"></script>
<script>
    let n = 0;
    //绑定单击事件
    $('button').click(()=>{
        n++;
        $('ul').animate(
            {
               left: -500*n
            },400,()=>{
            //动画执行完，要做的事情
                if(n==3){
                    n=0;
                    //改变整个ul的位置
                    $('ul').css("left",0);
                }
        })
    })
</script>
</html>